package com.example.myapplication.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.example.myapplication.R;
import com.example.myapplication.utils.BannerTool;
import com.example.myapplication.utils.BannerTool02;

import java.util.ArrayList;
import java.util.List;


public class HelpFragment extends Fragment {
    private ViewPager banner;
    private View view;
    private List<Integer> arrayList;
    private Handler handler;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        view = inflater.inflate(R.layout.fragment_help, container, false);
        init();
        initBanner();
        return view;
    }

    private void initBanner() {
        handler.post(new Runnable() {
            @Override
            public void run() {
                arrayList = new ArrayList<>();
                arrayList.add(R.drawable.fp4);
                arrayList.add(R.drawable.fp2);
                arrayList.add(R.drawable.fp3);
                BannerTool02 bannerTool = new BannerTool02(HelpFragment.this.getContext(),arrayList,banner);
                banner.setAdapter(bannerTool);
            }
        });
    }

    private void init() {
        banner = view.findViewById(R.id.banner);

        handler = new Handler();

    }
}